<template>
  <!--二维码页面-->
  <div class="guibinting">
  </div>
</template>

<script type="text/ecmascript-6">
  import {getCanScanGoods} from '../../../test/unit/http'

  export default {
    name: 'saomaindex',
    props: {},
    data() {
      return {
        goodsList: []
      };
    },
    methods: {
      goSaomadetail(accountGoodsId) {
        this.$router.push({path: 'saomadetail', query: {accountGoodsId: accountGoodsId}});
      },
      goSaoma() {
        this.$router.push({path: 'saoma'});
      },
      getCanScanGoodsData(params) {
        getCanScanGoods(params).then(res => {
          console.log(res);
          if (res.code == 100) {
            let goodsList = res.object;
            let length = goodsList.length;
            if (length == 1) {
              let accountGoodsId = goodsList[0].accountGoodsId;
              this.goSaomadetail(accountGoodsId)
            } else {
              this.goSaoma();
            }
          }
        })
      }
    },
    created() {
      let params = {isVipCard: 1};
      this.getCanScanGoodsData(params);
    },
    components: {}
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">

</style>
